/*
 * Copyright 2012 Faculty of Informatics - Masaryk University.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cz.muni.fi.pa165.creatures.dao.web;

import cz.muni.fi.pa165.creatures.model.web.Function;
import java.util.List;

/**
 * This interface represents a contract for implementation of the DAO for the
 * {@link cz.muni.fi.pa165.creatures.model.web.Function} entity.
 *
 * @author xmiklos1
 */
public interface FunctionDAO {

    /**
     * Create a new function.
     *
     * @param function a function to be created
     * @return id of just created function.
     */
    Long create(Function function);

    /**
     * Update existing function.
     *
     * @param function a user to be updated
     */
    void update(Function function);

    /**
     * Remove existing function.
     *
     * @param function a function to be removed
     */
    void remove(Function function);

    /**
     * Get a function by its id.
     *
     * @param id id of wanted function
     * @return the function with the given {@code id} or null if a function
     * doesn't exist
     */
    Function get(Long id);

    /**
     * Get count of all functions.
     *
     * @return number of all functions
     */
    Long getCount();

    /**
     * Get all functions.
     *
     * @return list of all functions
     */
    List<Function> getAll();

    /**
     * Remove all existing functions.
     */
    void removeAll();

    /**
     * Gets function by its name.
     *
     * @param name name of the function to get
     * @return function of the specified name
     */
    Function getByName(String name);
}
